#!/bin/bash

# 证书MD5指纹
keytool -list -v -keystore jjwj.jks -storepass 123123 -keypass 123123

# 证书MD5指纹
keytool -exportcert -keystore jjwj.jks -storepass 123123 -keypass 123123 | openssl dgst -md5  # -binary | openssl enc -base64

# 导出公钥文件
keytool -export -alias "jjwx" -file jjwx.cer -keystore jjwj.jks -storepass 123123

# 转换成pem证书
#openssl x509 -inform der -in jjwx.cer -out jjwx.pem

# 查看公钥
keytool -list -rfc --keystore jjwj.jks  -storepass 123123 | openssl x509 -inform pem -pubkey